@extends('layouts.frontend-base')


@section('css')

   <style>
       .hidden{
           display:none;
       }
       .warn_box{
           border-radius:5px;
           display:none;
           border:1px solid #ddd;
           width:290px;
           background-color:red;
           opacity:0.4;
           height:70px;
           line-height:70px;
           position:fixed;
           left:960px;
           bottom:100px;

       }
       .warn_box:hover{
           box-shadow:0 0  8px rgba(0,0,0,0.5);
           -moz-box-shadow:0 0 8px rgba(0,0,0,0.5);
           -webkit-box-shadow:0 0 8px rgba(0,0,0,0.5);

       }
       .J-alink{
           color:white;
           font-size:1.1em;
       }
       .warn_box a img{
           vertical-align:middle;
           margin-left:1em;
           margin-right:.3em;
           width:23px;
           height:30px;
       }
   </style>

@stop

@section('content')

    <div id="flashContent">

    </div>

    <iframe id="J-iframe" src="" frameborder="0" width="100%" height="100%"></iframe>

    <div id="warn_box" class="warn_box">
       <a  href="/frontend/warn/last-temp" class="J-alink" >
       </a>
    </div>

@stop



@section('js')
    <script src="/dist/admin/js/swfobject.js"></script>
    <script src="/dist/admin/js/client.js"></script>
    <script>
        function notice_iframe_height(height) {
            $('#J-iframe').height(height);
        }
        function notice_iframe_url(url){
            window.location.hash=url;
        }



        $(function () {
            $('.J-alink').click(function () {
                var href = $(this).attr('href');
                $('#J-iframe').attr('src', href);
                return false;
            });

            var iframe_url = window.location.hash;
            if (iframe_url) {
                iframe_url = iframe_url.replace('#', '');
                $('#J-iframe').attr('src', iframe_url);
            }else{
                $('#J-iframe').attr('src', '/frontend/index');
            }

        });

    </script>
    <script>

    </script>
    <script>
        function warnbox(){
            $.get('/frontend/warn/warn-status',function(data){
                if(data.status == 1)
                {
                    var count=data.data;
                    $('#warn_box').css('display','block');
                    $('.J-alink').html('<img src="/dist/home/img/phoe.png">'+'当前你有'+count+'条最新报警信息'
                    )
                }
            });

            $('#warn_box').click(function(){
                $(this).css('display','none');
            });
//            setTimeout("clearaway()",60000);
//            $.get('/frontend/warn/status-become-passed',function(data){
//                });
        }
        function clearaway(){
            $('#warn_box').animate({opacity:'hide'},'slow');

        }

        setInterval('warnbox()',60000)
    </script>
    <script>
        $(function () {
            $('.J-link').click(function () {
                var href = $(this).attr('href');
                $('#J-iframe').attr('src', href);
                return false;
            });

            var iframe_url = window.location.hash;
            if (iframe_url) {
                iframe_url = iframe_url.replace('#', '');
                $('#J-iframe').attr('src', iframe_url);
            }else{
                $('#J-iframe').attr('src', '/frontend/index');
            }

        });

    </script>


@stop